<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="jdk.pojo.*" import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>一篇blog</title>
</head>
<body>
<!-- 显示博客内容 -->
<%
    int blogID=0;//用于在这个jsp的生命周期内存储blogID
    List<Articales> oneALists=(List<Articales>)session.getAttribute("oneALists");
    for(Articales a:oneALists){
    	out.print(a.getTitle());
    	System.out.println(request.getParameter("editRight")+"===============");
    	if(request.getParameter("editRight").equals("Y")){//利用主页面blogIndex.jsp传过来的额参数判断是否拥有删除文章和编辑文章的权限
    		out.print("|<a href=\"EditBlogAction.jdk?bIndexShowCon=editBlog&QnewBlog=showCo&QBlogID="+a.getId()+"\">编辑</a>|<a href=\"DelBlogAction.jdk?QbIndexShowCon=allBlog"+"&QblogID="+a.getId()+"\">删除</a></br>");
	    }
    	out.print("<br/>");
    	out.println();
    	out.print(a.getContent());
    	blogID=a.getId();
    }
    session.removeAttribute("oneALists");
%>
<hr/>
<!-- 显示所有评论块 -->
<%
    //取出session的reLists对应的值并遍历显示
    List<Reviews> reLists=(List<Reviews>)session.getAttribute("reLists");
    for(Reviews re:reLists){
    	 
    	 if(re.getIns_uid()==oneALists.get(0).getIns_uid()){
    		 //如果创建者是本文的博主
    		 out.print("创建者ID："+re.getIns_uid()+"|<a href=\"DelReAction.jdk?QblogID="+blogID+"&QDelRe="+re.getId()+"\""+">删除</a></br>");
    	 }
        
        
         //删除出错的提示信息
         String errorMsg=(String)session.getAttribute("errorMsg");
         if(errorMsg!=null && !errorMsg.equals("")){
        	 out.print(errorMsg+"</br>");
         }
         out.print(re.getBulletin_board_name()+"</br>");//显示评论内容
    }
    session.removeAttribute("reLists");
%>
<hr/>
<!-- 编辑评论的区域 -->
<form method=post action="EditReAction.jdk?QblogID=<%=blogID %>">
     <p><a name="edit_review">发表评论</a></p>
     <p><%=(String)session.getAttribute("errorMsg") %></p>
     <% session.removeAttribute("errorMsg");  %>
     <textarea  
           cols="40" id="review_body" name="content" rows="20" style="width: 510px; height: 350px;">
     </textarea>
     <input type="submit" value="提交">
     
   
</form>
</body>
</html>